import request from '@/utils/request'

export function getSendFlowNode(modulepath, unid, sslb) {
    return request({
        url: '/flow/func/getSendFlowNode',
        method: 'get',
        params: { unid: unid, modulename: modulepath, sslb: sslb ? sslb : "" }
    })
}

export function sendDoc(urlparameter) {
    return request({
        url: '/flow/func/sendDoc',
        method: 'get',
        params: urlparameter,
        headers: {
            'Content-Type': 'application/json;charset=UTF-8'
        }
    })
}

/**
 * 回收重办
 * @param { Object } params 
 * @returns 
 */
export function getCallbackNode(params) {
    return request({
        url: '/flow/func/getCallbackNode/',
        method: 'get',
        params: params
    })
}
export function getYb(unid) {
    return request({
        url: '/flow/func/finishDocFlow',
        method: 'get',
        params: unid
    })
}

export function getCurrentFlowCount(unid) {
    return request({
        url: '/flow/func/getCurrentFlowCount',
        method: 'get',
        params: unid
    })
}


// export function callbackDoc (modulepath, urlparameter, dataparams) {
//   return request({
//     url: modulepath + '/callbackDoc',
//     method: 'post',
//     data: dataparams,
//     params: urlparameter,
//     headers: {
//       'Content-Type': 'application/json;charset=UTF-8'
//     }
//   })
// }

export function callbackDoc(urlparameter) {
    return request({
        url: '/flow/func/callbackDoc',
        method: 'get',
        params: urlparameter,
        headers: {
            'Content-Type': 'application/json;charset=UTF-8'
        }
    })
}

export function addExecution(modulepath, urlparameter) {
    return request({
        url: modulepath + '/addExecution',
        method: 'get',
        params: urlparameter,
        headers: {
            'Content-Type': 'application/json;charset=UTF-8'
        }
    })
}

export function isAddExecution(wjUnid) {
    return request({
        url: '/is/' + wjUnid,
        method: 'get',
    })
}


export function getBwgzList(params) {
    return request({
        url: '/FlowBwgz/list',
        method: 'get',
        params: params
    })
}

export function isCurrentFlowPerson(urlparameter) {
    return request({
        url: '/flow/func/isCurrentFlowPerson',
        method: 'get',
        params: urlparameter,
        headers: {
            'Content-Type': 'application/json;charset=UTF-8'
        }
    })
}

export function writeNotion(parameter) {
    return request({
        url: '/flow/func/writeNotion',
        method: 'get',
        params: parameter,
        headers: {
            'Content-Type': 'application/json;charset=UTF-8'
        }
    })
}

/**
 * 
 * @param {Object} parameter 
 * @param {String} parameter.docIdent
 * @param {String} parameter.moduleName
 * @param {String} parameter.notionContent
 * @param {String} parameter.notionType
 * @param {String} parameter.published
 * @param {String} parameter.sourceClient
 * @param {String} parameter.fileType
 * @param {String} parameter.sslb
 * @param {String} parameter.flowstructureunid
 * @param {String} parameter.file base64字符串
 * @returns 
 */
export function writeNotionWithImage(parameter) {
    return request({
        url: '/flow/func/writeNotionWithImage',
        method: 'post',
        data: parameter,
        headers: {
            'Content-Type': 'multipart/form-data; boundary=----WebKitFormBoundaryO1SKktFAu4rzycY6',
            'repeatSubmit': false,
        }
    })
}

export function getpublishDoc(params) {
    return request({
        url: '/flow/func/publishDoc',
        method: 'get',
        params: params
    })
}

//退回接口
export function sendbackDoc(params){
    return request({
        url:"/flow/func/sendbackDoc",
        method:"get",
        params,
    })
}